

#include <iostream>
#include <vector>
#include <algorithm>

void sortOdd(std::vector<int>& v )
{
	//v.clear();
	int* p = &v[0];
	int* q = &v[v.size() - 1];
	while (p < q)
	{
		if (*p % 2 == 0)
		{
			p++;
			continue;
		}
		if (*q % 2 == 1)
		{
			q--;
			continue;
		}
		std::swap(*q, *p);
	}
	
}



int main(void)
{
	const int length = 20;
	std::vector<int> v;
	v.reserve(length);
	for (size_t i = 0; i < length; i++)
	{
		v.push_back(rand() % 100);
	}
	
	std::for_each(v.begin(), v.end(), [](int t) {std::cout << t << "   "; });
	std::cout << std::endl;
	sortOdd(v);
	std::for_each(v.begin(), v.end(), [](int t) {std::cout << t << "   "; });
	
	
	
	
	
	
	return 0;
}